|
ARD2
1.00 for Rev B. Hardware
Airbag Reference Demonstrator using MPC5604P
|
Side-project utilities that help with data manipulation. More...
Go to the source code of this file.
Defines | |
| #define | TRUE (1u) |
| #define | CLEAR (0u) |
| #define | BITS_IN_NIBBLE (4u) |
| #define | BITS_IN_BYTE (8u) |
| #define | BITS_IN_16 (16u) |
| #define | BITS_IN_24 (24u) |
| #define | BYTES_IN_16 (2u) |
| #define | BYTES_IN_32 (4u) |
| #define | MSB_8_BITS (0x80u) |
| #define | MSB_MINUS_ONE (0x07u) |
| #define | BIT_DEFINITION |
| #define | BIT0 (1u << 0u) |
| #define | BIT1 (1u << 1u) |
| #define | BIT2 (1u << 2u) |
| #define | BIT3 (1u << 3u) |
| #define | BIT4 (1u << 4u) |
| #define | BIT5 (1u << 5u) |
| #define | BIT6 (1u << 6u) |
| #define | BIT7 (1u << 7u) |
| #define | BIT8 (1u << 8u) |
| #define | BIT9 (1u << 9u) |
| #define | BIT10 (1u << 10) |
| #define | BIT11 (1u << 11) |
| #define | BIT12 (1u << 12) |
| #define | BIT13 (1u << 13) |
| #define | BIT14 (1u << 14) |
| #define | BIT15 (1u << 15) |
| #define | BIT16 (1u << 16) |
| #define | BIT17 (1u << 17) |
| #define | BIT18 (1u << 18) |
| #define | BIT19 (1u << 19) |
| #define | BIT20 (1u << 20) |
| #define | BIT21 (1u << 21) |
| #define | BIT22 (1u << 22) |
| #define | BIT23 (1u << 23) |
| #define | BIT24 (1u << 24) |
| #define | BIT25 (1u << 25) |
| #define | BIT26 (1u << 26) |
| #define | BIT27 (1u << 27) |
| #define | BIT28 (1u << 28) |
| #define | BIT29 (1u << 29) |
| #define | BIT30 (1u << 30) |
| #define | BIT31 (1u << 31) |
| #define | N_ELEMENTS(X) (sizeof(X)/sizeof(*(X))) |
Functions | |
| uint8_t | u8fnCheckOddParity (uint8_t u8Byte, uint8_t u8ParityPosition) |
| Checks a byte for odd parity. | |
| uint16_t | u16fnCheckOddParity (uint16_t u16Word, uint16_t u16ParityPosition) |
| Checks a 16-bit word for odd parity. | |
| uint32_t | u32fnCheckOddParity (uint32_t u32Word, uint32_t u32ParityPosition) |
| Checks a 32-bit word for odd parity. | |
| uint8_t | u8fnCRC8 (const uint8_t *pu8Buffer, uint8_t u8Poly, uint8_t u8MBitsize, uint8_t u8Remainder) |
| Compute a 8-bit CRC using a custom polynomial. | |
| void | vfnASCIIByteToHex (uint8_t *pu8Source, uint8_t *pu8Target, uint16_t u16NOfBytes) |
| Converts a data stream from ASCII words to HEX values. Note that Hex-values represented by two ASCII symbols are converted as two separate HEX values. | |
| void | vfnHexToASCIIMaskToList (const uint16_t cu16MaskList, uint8_t *pau8DataArray, uint16_t *pu16Index, const uint16_t cu16Mask) |
| Takes a mask list, and a particular mask value, and writes its position in ASCII in a given array, at the passed index position, followed by a comma and an empty space. | |
| void | vfnHexToASCII (uint8_t *pu8Source, uint8_t *pu8Target, uint16_t u16NOfBytes) |
| Converts a data stream from Hex to ASCII values. | |
| void | vfnCopyArray (uint8_t *pu8Source, uint8_t *pu8Target, uint16_t u16NOfBytes) |
| Copies an array to a different location using only code (no DMA). | |
| uint16_t | u16fnMaxU16DeltaInArray (const uint16_t *au16Array, uint8_t u8ArraySize) |
| Finds the max and the min values in a 16-bit array, and returns the difference between them. | |
| uint32_t | u32fnDiffAbsoluteValue (uint32_t au32Value1, uint32_t au32Value2) |
| Performs the absolute value of the difference between two numbers. | |
Side-project utilities that help with data manipulation.
Copyright (c) 2011 Freescale Semiconductor Freescale Confidential Proprietary
History:
| uint16_t u16fnCheckOddParity | ( | uint16_t | u16Word, |
| uint16_t | u16ParityPosition | ||
| ) |
Checks a 16-bit word for odd parity.
| u16Word,: | Word to be checked for parity. |
| u16ParityPosition,: | If non-zero, adds the parity bit to the byte if needed. |
| uint16_t u16fnMaxU16DeltaInArray | ( | const uint16_t * | au16Array, |
| uint8_t | u8ArraySize | ||
| ) |
Finds the max and the min values in a 16-bit array, and returns the difference between them.
| au16Array,: | pointer to the array to be analized. |
| u8ArraySize,: | Number of elements in the array. |
| uint32_t u32fnCheckOddParity | ( | uint32_t | u32Word, |
| uint32_t | u32ParityPosition | ||
| ) |
Checks a 32-bit word for odd parity.
| u32Word,: | Word to be checked for parity. |
| u32ParityPosition,: | If non-zero, adds the parity bit to the byte if needed. |
| uint32_t u32fnDiffAbsoluteValue | ( | uint32_t | au32Value1, |
| uint32_t | au32Value2 | ||
| ) |
Performs the absolute value of the difference between two numbers.
| au32Value1,: | First number |
| au32Value2,: | Second number |
| uint8_t u8fnCheckOddParity | ( | uint8_t | u8Byte, |
| uint8_t | u8ParityPosition | ||
| ) |
Checks a byte for odd parity.
| u8Byte,: | Byte to be checked for parity. |
| u8ParityPosition,: | If non-zero, adds the parity bit to the byte if needed. |
| uint8_t u8fnCRC8 | ( | const uint8_t * | pu8Buffer, |
| uint8_t | u8Poly, | ||
| uint8_t | u8MBitsize, | ||
| uint8_t | u8Remainder | ||
| ) |
Compute a 8-bit CRC using a custom polynomial.
| pu8Buffer,: | Pointer to initial 8-bit element to check. |
| u8Poly,: | Polynomial associated to the division. |
| u8MBitsize,: | Number of bits to check. |
| void vfnASCIIByteToHex | ( | uint8_t * | pu8Source, |
| uint8_t * | pu8Target, | ||
| uint16_t | u16NOfBytes | ||
| ) |
Converts a data stream from ASCII words to HEX values. Note that Hex-values represented by two ASCII symbols are converted as two separate HEX values.
| pu8Source,: | Pointer to initial element to convert |
| pu8Target,: | Pointer to initial element in the target |
| u16NOfBytes,: | Size in bytes of stream to convert |
| void vfnCopyArray | ( | uint8_t * | pu8Source, |
| uint8_t * | pu8Target, | ||
| uint16_t | u16NOfBytes | ||
| ) |
Copies an array to a different location using only code (no DMA).
| pu8Source,: | Pointer to initial element to copy |
| pu8Target,: | Pointer to initial element to where to copy |
| u16NOfBytes,: | Size in bytes of stream to copy |
| void vfnHexToASCII | ( | uint8_t * | pu8Source, |
| uint8_t * | pu8Target, | ||
| uint16_t | u16NOfBytes | ||
| ) |
Converts a data stream from Hex to ASCII values.
| pu8Source,: | Pointer to initial element to convert |
| pu8Target,: | Pointer to initial element in the target |
| u16NOfBytes,: | Size in bytes of stream to convert |
| void vfnHexToASCIIMaskToList | ( | const uint16_t | cu16MaskList, |
| uint8_t * | pau8DataArray, | ||
| uint16_t * | pu16Index, | ||
| const uint16_t | cu16Mask | ||
| ) |
Takes a mask list, and a particular mask value, and writes its position in ASCII in a given array, at the passed index position, followed by a comma and an empty space.
| cu16MaskList,: | Mask list containing element to evaluate. |
| pau8DataArray,: | Array were the result will be written. |
| pu16Index,: | Location where the ASCII value will be written. It will be updated to the next free location after the call. |
| cu16Mask,: | Mask value to compare the cu16MaskList against. |